const fs = require('fs');
const readline = require('readline');
const fileStream = fs.createReadStream('data');

// 流事件  nodejs它是一个异步i/o事件处理
const rl = readline.createInterface({ input: fileStream });

// 按行读取
rl.on('line', data => {
  console.log(data)
})
rl.on('close', () => {
  console.log('文件完成了')
})